<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文档细览</title>
    <link rel="stylesheet" type="text/css" href="./bootstrap/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="./json-viewer/jquery.json-viewer.css">


</head>
<body style="padding: 20px;">
    <form class="form-horizontal" role="form">
        <div class="form-group">
            <label  class="col-sm-2 control-label">标题：</label>
            <div class="col-sm-10" id="docview_docname" style="font-size: 16px;line-height: 35px;">

            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">摘要：</label>
            <div class="col-sm-10" id="docview_zhaiyao" style="font-size: 16px;line-height: 35px;background-color: #fff5d4;padding: 20px;">
                <pre id="json-renderer" ></pre>
            </div>


        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">创建时间：</label>
            <div class="col-sm-10" id="docview_crdate" style="font-size: 14px;line-height: 35px;">

            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">内容：</label>
            <div class="col-sm-10" id="docview_content" style="font-size: 16px;line-height: 35px;">

            </div>
        </div>
        <div class="form-group">
            <label   class="col-sm-2 control-label">相关附件：</label>
            <div class="col-sm-10" id="docview_attached">
                <table class="table">
                    <caption>上传附件列表</caption>
                    <thead>
                    <tr>
                        <th>名称</th>
                        <th>大小</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="thelist_uploadfile">

                    </tbody>
                </table>
            </div>
        </div>
    </form>



    <script type="text/javascript" src="./js/request.js"></script>
    <script type="text/javascript" src="./js/jquery.min.js"></script>
    <script type="text/javascript" src="./bootstrap/js/bootstrap.js"></script>
    <script type="text/javascript" src="./bootstrap/js/bootstrap-paginator.js"></script>
    <script type="text/javascript" src="./js/jquery.extend.date.js"></script>
    <script type="text/javascript" src="./json-viewer/jquery.json-viewer.js"></script>

    <script type="text/javascript">
        var getdocbydocid = webrootpath+"doc/getdocbydocid";
        var model_indexlm_selectbianlianglink = webrootpath+"lm/model_indexlm_selectbianlianglink";//查询文档概要属性信息



        $(function () {

            var docid = sessionStorage.getItem("docid");
            if (docid=="" || docid==undefined){
                alert("没有选择文档");
                return false;
            }
            $.get(getdocbydocid,{docid:docid},function (content) {
                $("#docview_docname").html(content.data.docname);

                if(content.data.docabstract!=undefined && content.data.docabstract.length>0){
                    try {
                        var parsezycontent = JSON.parse(content.data.docabstract);
                        var htmlstrs = "";
                        for(var i in parsezycontent){
                            htmlstrs+=" <div class=\"form-group\" style='padding: 10px;border-bottom: thin dashed;'>\n" +
                                "    <label for=\"firstname\" class=\"col-sm-2 control-label\" style='text-align: left;background-color: #f0f0f0;'>"+i+"</label>\n" +
                                "    <div class=\"col-sm-10\">\n" +
                                ""+parsezycontent[i]+
                                "    </div>\n" +
                                "  </div>";
                        }
                        $("#docview_zhaiyao").html(htmlstrs);
                    }catch (e){
                        var parsezycontent = content.data.docabstract;
                        $("#docview_zhaiyao").html(parsezycontent);
                    }


                    //$('#json-renderer').jsonViewer(parsezycontent, {collapsed: false, withQuotes: true, withLinks: false});


                }


                var date = new Date();
                date.setTime(content.data.crdate);
                $("#docview_crdate").html(timestampToTime(date));
                $("#docview_content").html(content.data.dochtmlcontent);

                var attachedlist = content.attachedlist;
                var htmlstr = "暂无附件";
                for(var i in attachedlist){
                    htmlstr += "<tr>"+
                        "<td>"+attachedlist[i].attachedtruename+"</td>"+
                        "<td>"+attachedlist[i].attachedsize+"</td>"+
                        "<td><span class=\"label label-danger\">下载</span></td>"+
                        "</tr>";
                }
                $("#thelist_uploadfile").html(htmlstr);

            });

        });




    </script>
</body>
</html>